package com.chis.jxc;

import com.chis.jm.bean.IndexMenuBean;
import com.chis.jmdatatimer.comm.JedisConnect;
import com.chis.jmdatatimer.comm.JedisSerializeUtil;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

import java.util.List;
import java.util.Map;

/**
 * 
 * @Description 测试session失效时间
 * @Company zwx
 * @author wlj
 * @version 2019年10月11日
 */
public class TestSession {
    public static void main(String[] args) {
        String userNo = args[0];
        ShardedJedisPool jedisPool = JedisConnect.getInstance().jedisPoolJxc;
        ShardedJedis jedis = jedisPool.getResource();
        jedis.select(15);
        Map<String,Object> session = (Map<String,Object>) JedisSerializeUtil.unserialize(jedis.get(userNo.getBytes()));
        List<IndexMenuBean> indexList = (List<IndexMenuBean>) session.get("menu");
        System.out.println("用户编码："+userNo);
        System.out.println("用户菜单："+indexList.size());
        System.out.println("过期时间："+jedis.ttl(userNo.getBytes()));


    }
}
